package org.example.auth.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.example.auth.mapper.SysUserMapper;
import org.example.auth.service.SysUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.example.model.system.SysMenu;
import org.example.model.system.SysUser;
import org.example.vo.system.RouterVo;
import org.springframework.stereotype.Service;

import java.lang.invoke.LambdaMetafactory;
import java.util.List;

/**
 * <p>
 * 用户表 服务实现类
 * </p>
 *
 * @author example
 * @since 2023-04-13
 */
@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements SysUserService {
//根据id修改状态
    @Override
    public void updateStatus(Long id, Integer status) {
//        根据userid来查询
       SysUser sysUser= baseMapper.selectById(id);
       sysUser.setStatus(status);
       baseMapper.updateById(sysUser);
    }

    //        根据用户名来查询
    @Override
    public SysUser getUserByUserName(String username) {
       LambdaQueryWrapper<SysUser> wrapper =new LambdaQueryWrapper<>();

       wrapper.eq(SysUser::getUsername,username);
        SysUser sysUser=baseMapper.selectOne(wrapper);
        return sysUser;
    }

}
